﻿
extends layout
block quote
  link(rel="stylesheet",href="/stylesheets/create.css")
  script(type="text/javascript",src="/javascripts/jquery-1.8.3.js")
  script(type="text/javascript",src="/javascripts/WdatePicker.js")
  script(type="text/javascript",src="/javascripts/utility.js")
  script(type="text/javascript",src="/javascripts/global.js")
  script(type="text/javascript",src="/javascripts/modules/vacation.js")
block content
  .margin_780_center
    div
      -var LengthGroup = [{Name:'全天(8小时)',value:'8'},{Name:'半天(4小时)',value:'4'}];
      -var isView = detail != null;
      form
        input(type="hidden",id="applicationID",value='#{isView ? detail.ApplicationId : ""}')
        input(type="hidden",id="operateNode",value='#{isApprove ? Node : ""}')
        ul.form_input_area
          li.form-title 休假申请
          li
            div
              .parameter_name 申请人：
              .parameter_input
                input(type="text",disabled="disabled",value="#{isView ? (detail.empName + '(' + detail.empNo + ')') : (user.ChineseName+'('+ user.EmployeeNo +')')}")
                input(type="hidden",value="#{isView ? detail.empName : user.ChineseName}",name="empName")
                input(type="hidden",value="#{isView ? detail.ProposerId : user.Id}",name="ProposerId",id="ProposerId")
                input(type="hidden",value="#{isView ? detail.empNo : user.EmployeeNo}",name="empNo")
            div
              .parameter_name
                span.red(data-validate="请选择假期类型！") *
                假期类型：
              .parameter_input
                select.vacation_type(name="LeaveTypeId")
                  each type in LeaveTypes
                    if isView && detail.LeaveTypeId == type.Id
                      option(value= "#{type.Id}",selected="selected")= type.LeaveType
                    else
                      option(value= "#{type.Id}")= type.LeaveType
            div
              //.parameter_name 年假剩余：
              //.parameter_input: input(type="text",disabled="disabled",name="annualLength")
          li
            div
              .parameter_name
                span.red(data-validate="请填写请假开始时间！") *
                请假开始时间：
              .parameter_input: input.calendar(type="text",value='#{isView ? detail.LeaveBeginTime : ""}',name="LeaveBeginTime",id="LeaveBeginTime",data-calendar-group="vacation",data-calendar-role="begin",onchange="CheckDateGroup('vacation')")
            div
              .parameter_name
                span.red(data-validate="请选择请假开始长度！") *
                长度：
              .parameter_input
                select(name="LeaveBeginLength",id="LeaveBeginLength",onchange="CheckDateGroup('vacation')")
                  each item in LengthGroup
                    if isView && detail.LeaveBeginLength == item.value
                      option(value= "#{item.value}",selected="selected")= item.Name
                    else
                      option(value= "#{item.value}")= item.Name
          li
            div
              .parameter_name
                span.red(data-validate="请填写请假结束时间！") *
                请假结束时间
              .parameter_input: input.calendar(type="text",name="LeaveEndTime",value='#{isView ? detail.LeaveEndTime : ""}',id="LeaveEndTime",data-calendar-group="vacation",data-calendar-role="end",onchange="CheckDateGroup('vacation')")
            div
              .parameter_name
                span.red(data-validate="请选择请假结束长度！") *
                长度
              .parameter_input
                select(name="LeaveEndLength",id="LeaveEndLength",onchange="CheckDateGroup('vacation')")
                  each item in LengthGroup
                    if isView && detail.LeaveEndLength == item.value
                      option(value="#{item.value}",selected="selected")= item.Name
                    else
                      option(value="#{item.value}")= item.Name
          li
            div
              .parameter_name
                span.red(data-validate="请计算请假总长度！") *
                请假总长度
              .parameter_input
                input(type="text",disabled="disabled",id="SettlementLength",value='#{isView ? detail.SettlementLength/8 : ""}')
                input(type="hidden",name="SettlementLength",id="hfSettlementLength",value='#{isView ? detail.SettlementLength : ""}')
                input(type="hidden",name="TotalTimeSpan",id="TotalTimeSpan",value='#{isView ? detail.TotalTimeSpan : ""}')
          li
            div.one_line
              .parameter_name 休假申请理由：
              .parameter_input: textarea(name="ReasonForLeave")= isView ? detail.ReasonForLeave : ""
          li
            div.one_line
              .parameter_name 上传文件：
              if isView 
                .parameter_input: span= detail.UploadFilePath
              else
                .parameter_input: input.fileUpload(type="file",name="UploadFilePath")
          li
            input(type="hidden",value="",name="operate",id="operateButton")
            div(style="float: right;margin-left: auto;margin-right: auto;width: 508px;")
              button.btn(href="#",onclick="CloseSelf();") 取消
              if isView && isApprove
                button.btn(href="#",onclick="ApproveVacation();return false;") 同意
                button.btn(href="#",onclick="RejectVacation();return false;") 拒绝
              else
                button.btn(href="#") 保存
                button.btn(href="#",onclick="SubmitVacation();return false;") 提交



  if isView
    script.
      $('input,textarea,select').attr('disabled',true);